﻿

#include "iocpSrv.h"
#include "main.h"
CIocpSrv Server;

VOID WINAPI ServiceProc(DWORD argc, LPTSTR* argv)
{
	Server.InitEnv();
	Server.Dispatch();
	Server.UninitEnv();
	return;
}

VOID WINAPI ServiceCtrlHandler(DWORD Opcode)
{
	HANDLE hMap;
	switch (Opcode)
	{
	case SERVICE_CONTROL_PAUSE:
	{
		g_ServiceStatus.dwCurrentState = SERVICE_PAUSED;
	}break;
	case SERVICE_CONTROL_CONTINUE:
	{
		g_ServiceStatus.dwCurrentState = SERVICE_RUNNING;
	}break;
	case SERVICE_CONTROL_STOP:
	{
		Server.Exit();
		g_ServiceStatus.dwWin32ExitCode = 0;
		g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
		g_ServiceStatus.dwCheckPoint = 0;
		g_ServiceStatus.dwWaitHint = 0;
		SetServiceStatus(g_ServiceStatusHandle, &g_ServiceStatus);
	}break;
	case SERVICE_CONTROL_INTERROGATE:
		break;

	}
	return;
}
